package com.usian.controller;

import com.usian.pojo.TbContent;
import com.usian.service.ContentService;
import com.usian.utils.AdNode;
import com.usian.utils.PageResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/service/content")
public class ContentServiceController {
    @Resource
    ContentService contentService;
    //根据分类 ID 查询分类节点内容
    @PostMapping("/selectTbContentAllByCategoryId")
    PageResult selectTbContentAllByCategoryId(@RequestParam Integer page, @RequestParam Integer rows, @RequestParam Long categoryId){
        return contentService.selectTbContentAllByCategoryId(page, rows, categoryId);
    }
    //添加分类内容
    @PostMapping("/insertTbContent")
    Integer insertTbContent(@RequestBody TbContent tbContent){
        return contentService.insertTbContent(tbContent);
    }
    //删除分类内容
    @RequestMapping("/deleteContentByIds")
    Integer deleteContentByIds(@RequestParam Long ids){
        return contentService.deleteContentByIds(ids);
    }
    //查询首页大广告位
    @RequestMapping("/selectFrontendContentByAD")
    List<AdNode> selectFrontendContentByAD(){
        return contentService.selectFrontendContentByAD();
    }
}
